//
//  NSLayoutConstraint+WSQScreenProportion.m
//  
//
//  Created by 翁胜琼 on 2019/2/17.
//

#import "NSLayoutConstraint+WSQScreenProportion.h"

@implementation NSLayoutConstraint (WSQScreenProportion)

- (BOOL)adapterWidth
{
    return true;
}

- (void)setAdapterWidth:(BOOL)adapterWidth
{
    if (adapterWidth){
        self.constant = self.constant * [self sq_getScreenScale];
    }
}

- (BOOL)adapterHeight
{
    return true;
}

- (void)setAdapterHeight:(BOOL)adapterHeight
{
    if (adapterHeight)
    {
        self.constant = self.constant * [self sq_getScreenDcale];
    }
}

- (CGFloat)sq_getScreenScale
{
    CGFloat scale = [UIScreen mainScreen].bounds.size.width / 375;
    return scale;
}

- (CGFloat)sq_getScreenDcale
{
    CGFloat scale = [UIScreen mainScreen].bounds.size.height / 667;
    return scale;
}

@end
